package com.tbit.uqbike.webmanager.dao.core;

import com.tbit.uqbike.object.pojo.BikeStatus;
import com.tbit.uqbike.object.pojo.NameCount;
import com.tbit.uqbike.object.pojo.dto.CommonDTO;
import com.tbit.uqbike.object.pojo.vo.RealTimePowerVO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author MyWin E-mail:335918956@qq.com
 * @version 1.0
 * @createTime 2019-12-17 17:37
 */
public interface StatDataDao {
    /**
     * 统计指定代理商的数据
     * 正常待租、骑行中、异常、故障
     *
     * @param accountIds
     * @return
     */
    List<BikeStatus> statCarStatus(@Param("accountIds") List<Integer> accountIds);

    NameCount countRideByAidsExDt(Map<String, Object> map);

    NameCount countVipByAidsExDt(Map<String, Object> map);

    NameCount countFineByAidsExDt(Map<String, Object> map);

    /**
     * 0：充值；1：押金
     */
    NameCount countRechargeByAidsExDt(Map<String, Object> map);

    NameCount countDepositByAidsExDt(Map<String, Object> map);

    List<NameCount> countRideByAidsExDtGroupAid(Map<String, Object> map);

    List<NameCount> countVipByAidsExDtGroupAid(Map<String, Object> map);

    List<NameCount> countFineByAidsExDtGroupAid(Map<String, Object> map);

    List<NameCount> countCarsGroupAid(Map<String, Object> map);

    /**
     * 车辆电量分布统计
     * 0-20
     * 20-40
     * 40-60
     * >60
     *
     * @param accountIds
     * @return
     */
    List<NameCount> statCarBattery(@Param("accountIds") List<Integer> accountIds);

    /**
     * 车辆空闲统计
     * 8 小时
     * 1 天
     * 2 天
     * 大于 2 天
     *
     * @param accountIds
     * @return
     */
    List<NameCount> statCarIdle(@Param("accountIds") List<Integer> accountIds);

    int countCars(@Param("accountIds") List<Integer> accountIds);

    /**
     * 用户类型统计
     * 免押会员数
     * 押金用户数
     * 实名认证
     * 信用认证数量
     * 黑名单用户
     *
     * @param accountIds
     * @return
     */
    Map<String, Integer> statNewUser(@Param("accountIds") List<Integer> accountIds, @Param("time") String time);

    Map<String, Long> statNewUserLong(@Param("accountIds") List<Integer> accountIds, @Param("time") String time);

    /**
     * 骑行卡收入统计
     *
     * @param map
     * @return
     */
    NameCount rideCardCount(Map<String, Object> map);

    /**
     * vip会员卡统计
     *
     * @param map
     * @return
     */
    NameCount statVipLog(Map<String, Object> map);


    NameCount getRideByRidelog(Map<String, Object> map);

    NameCount getVipCountMoney(Map<String, Object> map);

    NameCount getRideMember(Map<String, Object> map);

    NameCount getVipIncome(Map<String, Object> map);

    /**
     * 获取区域内调度订单记录最早一天的数据量
     *
     * @param accountId 帐户id
     * @return {@link Date}
     */
    Date getDispatchEarliestData(Integer accountId);

    /**
     * 根据指定时间查询的调度记录
     *
     * @param map 地图
     * @return {@link List}<{@link Map}<{@link String}, {@link Object}>>
     */
    CommonDTO getDispatchByTime(Map<String, Object> map);

    /**
     * 实时电量统计
     * @param accountIds 区域id列表
     * @return List<RealTimePowerVO>
     */
    List<RealTimePowerVO> realTimePower(@Param("accountIds") List<Integer> accountIds);

    /**
     * 获取空闲车辆统计
     * @param accountIds 区域id列表
     * @return List<RealTimePowerVO>
     */
    List<RealTimePowerVO> idleMachine(@Param("accountIds") List<Integer> accountIds);
}
